# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=tesseract-git
_sha=695f862bd711a147b1f27c7ea51b7592a934c77b
pkgver=20200221
pkgrel=2
pkgdesc="Tesseract Open Source OCR Engine"
url="https://github.com/tesseract-ocr/tesseract"
arch="all"
license="Apache-2.0"
makedepends="autoconf autoconf-archive automake cairo-dev icu-dev leptonica-dev libtool pango-dev tiff-dev"
replaces="tesseract-ocr"
subpackages="$pkgname-dev $pkgname-training"
source="tesseract-$pkgver.tar.gz::https://github.com/tesseract-ocr/tesseract/archive/$_sha.tar.gz
	include-time-h.patch
	"

builddir="$srcdir/tesseract-$_sha"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
        ./configure \
                --build=$CBUILD \
                --host=$CHOST \
                --prefix=/usr \
                --sysconfdir=/etc \
                --mandir=/usr/share/man \
                --infodir=/usr/share/info \
                --localstatedir=/var \
                --disable-static
        make
        make training
}

package() {
	make DESTDIR="$pkgdir" install
}

training() {
	cd "$builddir"
	make DESTDIR="$subpkgdir" training-install
}

sha512sums="a8d2396d56acf58d60ed3b3d1aeb77b52870bb1b83502070af79a5138f39a0aec27841a4fca4bdff114eb46d80630be67b2dfc8fc194f6b87c129d2357aea3c7  tesseract-20200221.tar.gz
b0fe8ed2f3d00f61749fffc7316392dbc063cd03084cba26ac84b7a3a374bebc75ad07ccb588d3f5ac83acc80d33bb9c2de05703ce50df86f48294f4a5be0424  include-time-h.patch"
